home *** CD-ROM | disk | FTP | other *** search
/ Fraggle Rock Season 1 Bonus CD / Fraggle Rock Season 1 Bonus CD.iso / pc / Game / Game.swf / scripts / DefineSprite_475_display / frame_1 / DoAction.as
Encoding:
Text File  |  2005-06-24  |  932 b   |  42 lines

  1. function init()
  2. {
  3.    this.digits = new Array(figure);
  4.    var _loc2_ = 0;
  5.    while(_loc2_ < figure)
  6.    {
  7.       var _loc4_ = "digit" + _loc2_;
  8.       this.attachMovie(this.clipname,_loc4_,_loc2_);
  9.       var _loc3_ = this[_loc4_];
  10.       _loc3_._x = _loc2_ * _loc3_._width;
  11.       _loc3_.power = Math.pow(10,digits.length - _loc2_ - 1);
  12.       this.digits[_loc2_] = _loc3_;
  13.       _loc2_ = _loc2_ + 1;
  14.    }
  15. }
  16. function reset()
  17. {
  18.    this.value = this.initvalue;
  19.    updatedisplay();
  20. }
  21. function increment(n)
  22. {
  23.    var _loc2_ = Math.floor(n);
  24.    this.value += _loc2_;
  25.    updatedisplay();
  26. }
  27. function updatedisplay()
  28. {
  29.    var _loc5_ = this.value;
  30.    var _loc3_ = 0;
  31.    while(_loc3_ < this.figure)
  32.    {
  33.       var _loc2_ = this.digits[_loc3_];
  34.       var _loc4_ = int(_loc5_ / _loc2_.power);
  35.       _loc5_ -= _loc4_ * _loc2_.power;
  36.       _loc2_["set"](_loc4_);
  37.       _loc3_ = _loc3_ + 1;
  38.    }
  39. }
  40. init();
  41. stop();
  42.